import time
# from selenium.webdriver.support.u1 import WebDriverWait
# from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.common.by import By
# //*[@id="fromStationText"]
browser = webdriver.Chrome()
browser.get('https://www.12306.cn/index/')

# 定位到12306的出发地
id_from_word = 'fromStationText'

# 使用tuple
locator = (By.ID, id_from_word)
# 开始解析网页，强制等待10秒钟，如果没有返回网页就自动抛出异常
# wait = WebDriverWait(browser, 10).until(EC.presence_of_element_located(locator))

# 通过locator找到对应的输入框
input = browser.find_element(By.ID, id_from_word)

input.clear()
input.send_keys("厦门北")

# //*[@id="toStationText"]
id_to_word = 'toStationText'
locator = (By.ID, id_from_word)
input = browser.find_element(By.ID, id_to_word)
input.clear()
input.send_keys("泉州")
time.sleep(7)